<template>
  <div class="profile-container">
    <el-card class="box-card">
      <template v-slot:header>
        <div class="clearfix">
          <span>个人资料</span>
        </div>
      </template>

      <!-- 用户头像 -->
      <div class="avatar-wrapper">
        <el-avatar :size="100" :src="imgsrc"></el-avatar>
      </div>

      <!-- 基本信息展示 -->
      <div class="user-info">
        <el-descriptions :column="1" label-width="80px">
          <el-descriptions-item label="用户名">{{ userInfo.username }}</el-descriptions-item>
          <el-descriptions-item label="职位">{{ userInfo.position }}</el-descriptions-item>
        </el-descriptions>
      </div>
    </el-card>
  </div>
</template>

<script>
import userAvatar from '@/assets/images/user-avatar.jpg'

export default {
  name: 'ProfileView',
  data() {
    return {
      imgsrc: userAvatar // 使用导入的图片路径
    }
  },
  computed: {
    userInfo() {
      return this.$store.getters.getUserInfo
    }
  }
}
</script>

<style scoped>
.profile-container {
  padding: 20px;
}

.box-card {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.avatar-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin-bottom: 20px;
}

.user-info {
  max-width: 400px;
  margin: 0 auto;
}

.clearfix span {
  font-size: 18px;
  font-weight: bold;
}
</style>